package com.zzq.gmall.product.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzq.gmall.common.result.Result;
import com.zzq.gmall.model.product.SkuInfo;
import com.zzq.gmall.product.service.SkuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 幼儿猿大班
 * 2023/2/16
 */
@RestController
@RequestMapping("/admin/product")
public class SkuController {



    @Autowired
    SkuInfoService skuInfoService;


    /**
     * 查询skuinfo列表信息
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("/list/{page}/{limit}")
    public Result getSkuList(@PathVariable("page") Long page,
                             @PathVariable("limit") Long limit){

        Page<SkuInfo> page1 = skuInfoService.page(new Page<>(page, limit));

        return Result.ok(page1);
    }


    /**
     * 保存skuInfo信息
     * @param skuInfo
     * @return
     */
    @PostMapping("/saveSkuInfo")
    public Result saveSkuInfo(@RequestBody SkuInfo skuInfo){

        skuInfoService.saveSkuInfo(skuInfo);

        return Result.ok();

    }




}
